package logic;

import data.JDBCProductDAO;


public class Product {
	
	private String id;
	private String category;
	private String name;
	private String description;
	private float price;
	private String iddonor;
	private String idbuyer;
	private String iddestination;
	private String regdate;
	private boolean active;
	private boolean sell;
	private String iduser;
	private double ratio;
	private static Product prod;
	private String destName;
	
	
	public Product(String category, String name,
			String description, float price, String iddonor,
			String iddestination) {
		super();
		this.category = category;
		this.name = name;
		this.description = description;
		this.price = price;
		this.iddonor = iddonor;
		this.iddestination = iddestination;
	}	
	
	public Product(){
		super();
	}
	
	public static synchronized Product getInstance(String id){
		if(prod == null){
			prod = new Product(id);
		}
		return prod;
	}
	
	
	public Product(String id) {
		prod = (new JDBCProductDAO()).selectProduct(id);
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public String getIddonor() {
		return iddonor;
	}

	public void setIddonor(String iddonor) {
		this.iddonor = iddonor;
	}

	public String getIdbuyer() {
		return idbuyer;
	}

	public void setIdbuyer(String idbuyer) {
		this.idbuyer = idbuyer;
	}

	public String getIddestination() {
		return iddestination;
	}

	public void setIddestination(String iddestination) {
		this.iddestination = iddestination;
	}

	public String getRegdate() {
		return regdate;
	}

	public void setRegdate(String regdate) {
		this.regdate = regdate;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public boolean isActive() {
		return active;
	}

	public boolean isSell() {
		return sell;
	}

	public void setSell(boolean sell) {
		this.sell = sell;
	}

	public String getIduser() {
		return iduser;
	}

	public void setIduser(String iduser) {
		this.iduser = iduser;
	}

	public void setRatio(double ratio2) {
		this.ratio = ratio2;
	}
	public double getRatio() {
		return ratio;
	}

	public void setNameDestination(String destName) {
		this.destName = destName;
	}
	public String getNameDestination(){
		return this.destName;
	}
	
}
